package org.btik.light.mobile.common.handler;

import android.view.View;
import org.btik.light.mobile.meta.mo.DefaultDevMo;


import java.util.function.Consumer;


public class SimpleController extends CmdSender implements Consumer<View>,DevBinder {
    private final SimpleCommand ctrlCommand;

    public SimpleController(int opcode, String... param) {
        this.ctrlCommand = new SimpleCommand(opcode, param);

    }

    @Override
    public void accept(View view) {
        send(view.getContext(), ctrlCommand);
    }


    @Override
    public void bind(DefaultDevMo devMo) {
        ctrlCommand.setTarget(devMo.getSn());
    }
}
